<%-- 
    Document   : admin_home
    Created on : 16 Jan, 2013, 7:27:53 PM
    Author     : s
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="connection.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>User Management Page</title>
        <link rel="stylesheet" type="text/css" href="css/theme.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script>
             var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
             document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '">');
        </script>
        <link rel="stylesheet" href="js/jquery-ui-1.8.23.custom/development-bundle/themes/base/jquery.ui.all.css">
        <script src="js/jquery-ui-1.8.23.custom/js/jquery-1.7.2.min.js" type="text/javascript"></script> 
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.mouse.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.button.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.draggable.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.position.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.resizable.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.dialog.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.datepicker.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.effects.core.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.autocomplete.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.accordion.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.tooltip.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.effects.explode.js"></script>
        
        <script>
    $(function() {
		$( "#sidebar" ).accordion({
			autoHeight:false,
                        event: "mouseover"
		});
                var availableTags = [<%
                        st=con.createStatement();
                        rs=st.executeQuery("select ticker from company");
                        while(rs.next())
                        {
                          out.print("\""+rs.getString(1)+"\",");  
                        }
                        %>];
		$( "#sym_id" ).autocomplete({
			source: availableTags
		});
                
                $("#del_usr").live('click',function(){
                    var id=$(this).attr("dir").toString();//alert(id);
                    $("input#val").attr("value",id);
                   // alert($("input#val").attr("value"));
                    $( "#del_dlg" ).dialog( "open" );
                    
                });
               
				
		
                  
                $( "#del_dlg" ).dialog({
			autoOpen: false,
			height: 200,
                        width: 350,
                        show:"explode",
                        hide: "explode",
                        modal:true,
                        buttons: {
				"Delete": function() {
                                   // $(this).dialog("close");
                                    //$("#del_form").submit();
                                    $("#frm").submit();
                                    $( this ).dialog( "close" );			
				},
				Cancel: function() {
                                        
					$( this ).dialog( "close" );
				}
			}
		});
	});
        
    
</script>
            
    </head>
    <body>
                          
        <div id="container">
                <div id="header">
                    <h2>Stock Market Website</h2>
                    <div id="topmenu">
                      <ul>
                    <li><a href="admin_home.jsp">Dashboard</a></li>
                    <li class="current"><a href="admin_users.jsp">Users</a></li>
                    <li><a href="companies.jsp">Companies</a></li>
                   <!-- <li><a href="portfolio.jsp">Portfolio</a></li>
                    <li><a href="charts.jsp">Charts</a></li>-->
                  <!--  <li><a href="chatgroup_admin.jsp">Chat Group</a></li>-->
                    <li><a href="experts_admin.jsp">Experts</a></li>
                    <!--                    <li><a href="emails.jsp">Emails</a></li>-->
                      </ul>
                    </div>
                </div>
        <div id="top-panel">
          
          <form action="" name="quoteform" >
              	<input type="text" placeholder="Enter company symbol" name="sym_nm" id="sym_id" />
                <input type="submit" value="Get Stock Value" />
            </form>
          
      </div>
        <div id="wrapper">
            <div id="content">
                <div id="con">
                <div id="box">
                    <h3>Users</h3>
                    
                    <%
                        String msg=null;
                        if(request.getParameter("msg")!=null)
                        {
                            msg=request.getParameter("msg");
                            out.print("<font></font>");
                            out.println(msg);
                        }
                        st = con.createStatement();
                        rs = st.executeQuery("select * from user");
                     %>
                     <table border='1'>
                         <thead>
                             <tr>
                            <th><center><b>Sr No</b></center></th>
                            <th><center><b>Name</b></center></th>
                            <th><center><b>ID</b></center></th>
                            <th><center><b>Mobile NO</b></center></th>
                            <th><center><b>Package</b></center></th>
                            <th><center><b>Sub_St_Date</b></center></th>
                            <th><center><b>Operations</b></center></th>
                            </tr>
                    </thead>
                        <%   
                        
                        while(rs.next())
                        {
                            out.print("<tr>");
                                                                           
                            out.print("<td>");
                            out.print(rs.getString(1));
                            out.print("</td>");
                            
                            out.print("<td>");
                            out.print(rs.getString(3)+" "+rs.getString(4));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(2));
                            out.print("</td>");
    
                            out.print("<td>");
                            out.print(rs.getString(6));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(7));
                            out.print("</td>");

                            out.print("<td>");
                            out.print(rs.getString(8));
                            out.print("</td>");
                            
                            out.print("<td>");
                            
                            out.print("<a href='#' id='del_usr' dir='"+rs.getShort(1)+"'><img src='img/icons/user_delete.png'></a>");
                            out.print("</td>");
                            

                        }
                        rs.close();
                        %>
                        
                        
                        
                     </table>
                
                </div>
            </div>       
                        <div id="box">
                            <h3>
                                                                
                                    Rows per Page:
                                     
                                    <input type="text" value="10" id="record" />
                                    <input type="button"  id="show" value="Show"/>
                              
                            </h3>
                            <h3 id="pagenav">
                                
                                  Page No:  
                                  <div id="abc">
                                  <script>
                                          var rec;
                                            $(document).ready(function(){
                                                
                                                $("#pagenav").hide();
                                                $("#show").click(function(){
                                                    rec=parseInt(document.getElementById("record").value);
                                                    //alert(rec);
                                                    var data="rec="+rec;
                                                    $("#pagenav").show(500);
                                                    
                                                    $("div#con").load("user_ajax.jsp?rec="+rec+"&page=0 #box");
                                                   
                                                  /*  $.getJSON("page_no_ajax.jsp?rec="+rec,function(data){
                                                       alert(data.page); 
                                                       var i;
                                                       var s = "<select>";
                                                       for(i=0;i<data.page;i++){
                                                          //var s="<option value='"+i+"'>"+(i+1)+"</option>";
                                                           s = s + "<option value='"+i+"'>"+(i+1)+"</option>";
                                                           //$("h3#pagenav").append("<option>a</option>");
                                                           //$("h3#pagenav").append("><option>"+i+"</option");
                                                       }
                                                       $("h3#pagenav").append(s);    
                                                        $("h3#pagenav").append("</select>");    
                                                    });*/
                                                    $("div#abc").load("user_ajax.jsp?rec="+rec+"&page=0 #pagena");    
                                                    
                                                    });
                                                    /*$("div#pagena sel").change(function(){
                                                        alert("change");
                                                        
                                                        
                                                    });*/
                            
                                                 
                                            });
                                             function abc(){
                                                           
                                                           var page=parseInt(document.getElementById("sel").value);
                                                           
                                                        $("div#con").load("user_ajax.jsp?rec="+rec+"&page="+page+" #box");
                                                       
                                                    }
                                                    
                                
                        </script> 
                        
                        </div>
                            </h3>    
                            
                            
                        </div> 
                        <form action='user_delete.jsp' id='frm'>
                            <input type='hidden' name='val' id="val"/>
                            <input type='hidden' name='op' value='del'/>
                        </form>
                <p>&nbsp;</p>
            </div>
            <div id="del_dlg">
                                    <p>Delete this user?</p>
                                </div>             
                        

        <div id="sidebar">
  	
                	<li><h3><a href="#" class="house">Dashboard</a></h3>
                        <ul>
                        	<li><a href="logout.jsp" class="report">Logout</a></li>
                        </ul>
                    </li>
                                  
                  <li><h3><a href="#" class="user">Users</a></h3>
          				<ul>
                             
            				<li><a href="find_user.jsp" class="search">Find user</a></li>
                            
                        </ul>
            </li>
				       
          </div>
      </div>
        <div id="footer">
        <div id="styleswitcher">
            <ul>
                <li><a href="javascript: document.cookie='theme='; window.location.reload();" title="Default" id="defswitch">d</a></li>
                <li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">g</a></li>
                <li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">m</a></li>
                <li><a href="javascript: document.cookie='theme=5'; window.location.reload();" title="Mix" id="defswitch">m</a></li>
            </ul>
        </div><br />

        </div>
</div>
</body>
</html>

                       
            

        